<%@ page session="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<title></title>
<script type="text/javascript" src="<c:url value="/resources/jquery-1.7.1.min.js" /> "></script>
<script type="text/javascript" src="<c:url value="/resources/json.min.js" /> "></script>
<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/demo.css" /> " />
</head>
<body>
<div id="div-regForm">
<span id="infosuccess" style="color: green; display: none;">User Account created Succesfully !!</span>
<span id="errorDisplay" style="color: blue; display: none;"></span>
<div class="form-sub-title">User Login</div>
<form:form id="loginForm"  modelAttribute="userForm" action="./login/authanticate" method="post">

	<table>
		
		<tr>
			<td valign="middle"><form:label id="userNameLabel" for="userName"
				path="userName">User Name</form:label></td>
				<td valign="top"><div class="input-container"><form:input path="userName" /></div></td>
		</tr>
			<tr>
				<td  valign="middle"><form:label id="passwordLabel" for="Password"
					path="password">Password</form:label></td>
				<td valign="middle"><div class="input-container"><form:password path="password" /></div></td>
			</tr>

			
			<tr>
				<td rowspan="3"><input id="create" type="submit" value="Create"
					class="greenButton" /></td>
			</tr>
	</table>
</form:form>

</div>
</body>
<script type="text/javascript">	
		$(document).ready(function() {
			
			$("#loginForm").submit(function() {
				$.postJSON("./authanticate", { userName: $('#userName').val() , password: $('#password').val()}, 
				function(userExist) {
					if (userExist) {
					
					}else{
						$("#loginForm")[0].reset();
					}
				});	
					
			});
		});

	</script>

</html>